'''
    Constants
'''
import sys


class Constant:
    # 定义为类只读属性
    # 停止数据库成功返回信息
    @property
    def STOP_SUCCESS_MSG(self):
        return 'Successfully stopped cluster.'

    # 启动数据库成功返回信息
    @property
    def START_SUCCESS_MSG(self):
        return 'Successfully started.'

    # 启动数据库Degraded返回信息
    @property
    def START_DEGRADED_MSG(self):
        return '[GAUSS-51607] : Failed to start cluster. After startup, ' \
               'the last check results were Degraded. Please check manually.'

    # 启动数据库成功，但数据库集群状态有异常
    @property
    def FAILED_START_MSG_DEGRADED(self):
        return 'Failed to start cluster. After startup, ' \
               'the last check results were Degraded. Please check manually.'

    # 查询数据库状态为启动时返回信息
    @property
    def START_STATUS_MSG(self):
        return 'Normal'

    # 查询数据库状态为停止时返回信息
    @property
    def STOP_STATUS_MSG(self):
        return 'stopped'

    # 实例正常运行
    @property
    def INSTANCE_RUNNING(self):
        return 'gs_ctl: server is running'

    # 使用gs_ctl停止数据库成功返回信息
    @property
    def GS_CTL_STOP_SUCCESS_MSG(self):
        return 'server stopped'

    # 连接数据库成功返回信息
    @property
    def CONN_DB_SUCCESS_MSG(self):
        return 'List of databases'

    # gs_guc执行成功返回信息
    @property
    def GSGUC_SUCCESS_MSG(self):
        return 'Failed instances: 0.'

    # 重建成功返回信息
    @property
    def REBUILD_SUCCESS_MSG(self):
        return 'server started'

    # 重建失败信息
    @property
    def BUILD_FAIL_MSG(self):
        return "can't find primary"

    # 重建失败信息
    @property
    def BUILD_FAIL_MSG1(self):
        return 'could not connect to server'

    # 重建失败信息
    @property
    def BUILD_FAIL_MSG2(self):
        return 'FATAL:  could not load server certificate ' \
               'file "server.crt": no start line'

    # 重建失败信息
    @property
    def BUILD_FAIL_MSG3(self):
        return 'FATAL:  could not load the ca certificate file'

    @property
    def BUILD_FAIL_MSG4(self):
        return ' could not access private key file'

    # 备机磁盘空间不足重建失败信息
    @property
    def NO_SPACE_BUILD_FAIL_MSG(self):
        return ' No space left on device'

    # 备机磁盘空间不足重建失败信息
    @property
    def NO_SPACE_BUILD_FAIL_MSG1(self):
        return 'fetch MOT checkpoint'

    # 停止某个节点成功返回信息
    @property
    def STOP_NODE_SUC_MSG(self):
        return 'Successfully stopped node.'

    # sql语句执行失败后返回信息
    @property
    def SQL_WRONG_MSG(self):
        wrong_msg_seq = ('No relations', 'ERROR', 'Invalid', 'FATAL')
        return wrong_msg_seq

    # linux系统中文件不存在返回信息
    @property
    def NO_FILE_MSG(self):
        return 'No such file or directory'

    # cfe注入进程故障返回进程不存在信息
    @property
    def no_process_msg(self):
        return 'no such process'

    # checkpoint失败信息
    @property
    def FAILED_CHECKPOINT(self):
        return 'connection to server was lost'

    # 备机base目录无权限，主机进行create操作，备机pg_log报错相应日志关键信息
    @property
    def REDO_FAILURE_MSG(self):
        return 'aborting  due to page redo process failure'

    # REFRESH成功信息
    @property
    def REFRESH_SUCCESS_MSG(self):
        return 'Successfully generated dynamic configuration file.'

    # REFRESH失败信息
    @property
    def REFRESH_FAIL_MSG(self):
        return 'Failed to write dynamic configuration file.'

    # switch执行中信息
    @property
    def SWITCH_ING_MSG(self):
        return 'server starting switchover'

    # switch执行成功信息
    @property
    def SWITCH_SUCCESS_MSG(self):
        return 'switchover completed'

    # switch执行失败信息
    @property
    def SWITCHOVER_FAIL_MSG(self):
        return 'switchover timeout after 60 seconds'

    # switch执行失败信息2
    @property
    def SWITCHOVER_CANNOT_MSG(self):
        return 'cannot switchover server'

    # 主节点正常信息
    @property
    def P_NORMAL(self):
        return 'P Primary Normal'

    # 备节点正常信息
    @property
    def S_NORMAL(self):
        return 'S Standby Normal'

    # 系统日志里面提示归档失败
    @property
    def FAILED_ARCHIVE_MSG(self):
        return "The failed archive command was"

    # 表或文件不存在返回信息
    @property
    def NOT_EXIST(self):
        return 'does not exist'

    # 创建表成功返回信息
    @property
    def TABLE_CREATE_SUCCESS(self):
        return 'CREATE TABLE'

    # 无效状态返回信息
    @property
    def UNAVAILABLE_STATUS(self):
        return 'Unavailable'

    # 权限不足返回信息
    @property
    def PERMISSION_DENIED(self):
        return 'Permission denied'

    # 无法打开文件返回信息
    @property
    def OPEN_FAIL(self):
        return 'could not open file'

    # 删除表成功返回信息
    @property
    def TABLE_DROP_SUCCESS(self):
        return 'DROP TABLE'

    # 连接失败返回信息
    @property
    def CONN_FAIL(self):
        return 'failed to connect'

    # 数据库参数值超出范围提示信息
    @property
    def OUTSIDE_MSG(self):
        return 'is outside the valid range for parameter'

    # 连接数据库失败信息
    @property
    def FAILED_CONNECT_DB(self):
        return 'failed to connect'

    # stopped单节点成功信息
    @property
    def STOP_NODE_SUCCESS_MSG(self):
        return 'Successfully stopped node'

    # 备节点正常信息
    @property
    def STANDBY_NORMAL(self):
        return 'Standby Normal'

    # 主节点正常信息
    @property
    def PRIMARY_NORMAL(self):
        return 'Primary Normal'

    # 重启成功信息
    @property
    def RESTART_SUCCESS_MSG(self):
        return 'server started'

    # TPCC 失败信息
    @property
    def TPCC_ERROR(self):
        return 'ERROR'

    # TPCC refuse
    @property
    def TPCC_REFUSE_MSG(self):
        return 'refused.'

    # TPCC success
    @property
    def TPCC_SUCCESS_MSG(self):
        return 'Session End'

    @property
    def PERMISSION_DENY_MSG(self):
        return 'Permission denied'

    @property
    def SWITCHOVER_SUCCESS_MSG(self):
        return 'switchover completed'

    @property
    def REFRESHCONF_SUCCESS_MSG(self):
        return 'Successfully generated dynamic configuration file'

    @property
    def CREATE_TABLE_SUCCESS(self):
        return 'CREATE TABLE'

    @property
    def DROP_TABLE_SUCCESS(self):
        return 'DROP TABLE'

    @property
    def FAILOVER_SUCCESS_MSG(self):
        return 'failover completed'

    @property
    def TPCC_CREATE_DATA_SUCCESS_MSG(self):
        return 'indexes built and extra\'s created'

    @property
    def DISK_FULL_MSG(self):
        return 'No space left on device'

    @property
    def RESTORE_SUCCESS_MSG(self):
        return 'restore operation successful'

    @property
    def CFE_DISK_FULL_SUCCESS_MSG(self):
        return 'successful execution [rfile full'

    @property
    def CFE_DISK_CLEAN_SUCCESS_MSG(self):
        return 'successful execution [rfile restore'

    @property
    def STANDBY_DOWN(self):
        return 'S Down'

    @property
    def BUILD_SUCCESS_MSG(self):
        return 'server started'

    @property
    def CLUSTER_NORMAL_MSG(self):
        return 'cluster_state   : Normal'

    @property
    def BUILD_FAIL_MSG_OPEN(self):
        return 'cannot be opened'

    @property
    def CLUSTER_DEGRADED_MSG(self):
        return 'cluster_state   : Degraded'

    @property
    def UNRECOGNIZED_SHUTDOWN_MSG(self):
        return 'unrecognized shutdown mode'

    @property
    def FAILED_START_MSG(self):
        return 'Can not start the database'

    @property
    def LOGIN_SUCCESS_MSG(self):
        return 'login'

    @property
    def LOGOUT_SUCCESS_MSG(self):
        return 'logout'

    @property
    def SSL_CONNECTION_CLOSED_MSG(self):
        return 'SSL connection has been closed unexpectedly, ' \
               'remote datanode (null), error: Success'

    @property
    def CONNECT_SEVER_SUCCESS_MSG(self):
        return 'connect to sever success, build started.'

    # 数据库建用户成功提示信息
    @property
    def CREATE_ROLE(self):
        return 'CREATE ROLE'

    @property
    def STOP_NOT_PERMIT_MSG(self):
        return 'Operation not permitted'

    @property
    def FAILED_TO_REMOVE_DIR(self):
        return 'failed to remove dir'

    @property
    def SUCCESS_CFE_FULL_FILENUM_MSG(self):
        return 'successful execution [rfile deplenish'

    @property
    def success_cfe_rfile_ideplenish_msg(self):
        return 'successful execution [rfile ideplenish'

    @property
    def success_cfe_rfile_clean_msg(self):
        return 'successful execution [rfile clean'

    @property
    def TOO_MANYY_FILE_MSG(self):
        return 'Too many open files'

    @property
    def RELOAD_SUCCESS_MSG(self):
        return 'server signaled'

    @property
    def CREATE_DATABASE_SUCCESS_MSG(self):
        return 'CREATE DATABASE'

    @property
    def LOW_PERM_DENIED_MSG(self):
        return 'permission denied'

    @property
    def CONNECT_LOST_MSG(self):
        return 'connection to server was lost'

    @property
    def CREATE_INDEX_SUCCESS_MSG(self):
        return 'CREATE INDEX'

    @property
    def CREATE_TBLSPACE_SUCCESS_MSG(self):
        return 'CREATE TABLESPACE'

    @property
    def CFE_INJECT_RDISK_SUCCESS_MSG(self):
        return 'successful execution [rdisk'

    @property
    def CFE_CLEAN_RDISK_SUCCESS_MSG(self):
        return 'successful execution [rdisk restore'

    @property
    def INJECT_RDISK_DB_PROMPT_MSG(self):
        return 'Input/output error'

    @property
    def CANNOT_ALLOCATE_MEMORY_MSG(self):
        return 'FATAL:  could not create shared memory ' \
               'segment: Cannot allocate memory'

    @property
    def CFE_INJECT_RMEM_SUCCESS_MSG(self):
        return 'successful execution [rmem total'

    @property
    def CFE_CLEAN_RMEM_SUCCESS_MSG(self):
        return 'successful execution [rmem resume]'

    @property
    def TIMEOUT_EXPIRED_MSG(self):
        return 'timeout expired'

    @property
    def RESTORE_FAIL_MSG(self):
        return 'error'

    @property
    def CONNECT_SERVER_FAIL_MSG(self):
        return 'could not connect to server'

    @property
    def REFRESH_MAT_VIEW_SUCCESS(self):
        return 'REFRESH MATERIALIZED VIEW'

    @property
    def COULD_NOT_START_SERVER_MSG(self):
        return 'could not start server'

    @property
    def BACKUP_BACKUP_SUCCESS_MSG(self):
        return 'Successfully backed up cluster files.'

    @property
    def BACKUP_RESTORE_SUCCESS_MSG(self):
        return 'Successfully restored cluster files.'

    @property
    def COULD_NOT_LOAD_MSG(self):
        return 'could not load'

    @property
    def BASEBACKUP_SUCCESS_MSG(self):
        return 'base backup successfully'

    @property
    def standby_need_repair(self):
        return 'Standby Need repair'

    @property
    def drop_database_success_msg(self):
        return 'DROP DATABASE'

    @property
    def create_schema_success_msg(self):
        return 'CREATE SCHEMA'

    @property
    def alter_schema_success_msg(self):
        return 'ALTER SCHEMA'

    @property
    def drop_schema_success_msg(self):
        return 'DROP SCHEMA'

    @property
    def cfe_iowait_success_msg(self):
        return '10000 10000'

    @property
    def drop_node_success_msg(self):
        return 'Success to drop the target nodes'

    @property
    def cfe_inject_netdown_success_msg(self):
        return 'successful execution [rNet'

    @property
    def cfe_inject_netflash_success_msg(self):
        return 'successful execution [rNetLink_flash'

    @property
    def cfe_inject_reorder_success_msg(self):
        return 'Illegal "reorder"'

    # 网络错包率
    @property
    def network_error_rate(self):
        return '3%'

    @property
    def jdbcgsbackup_success(self):
        return 'Connect complete'

    @property
    def jdbcgsbackup_failed(self):
        incorrect_msg = ('error', 'failed', 'FATAL')
        return incorrect_msg

    @property
    def insert_success_msg(self):
        return 'INSERT'

    @property
    def drop_role_success_msg(self):
        return 'DROP ROLE'

    @property
    def drop_tablespace_success_msg(self):
        return 'DROP TABLESPACE'

    # 创建目录对象成功
    @property
    def create_directory_success_msg(self):
        return 'CREATE DIRECTORY'

    # 删除目录对象成功
    @property
    def drop_directory_success_msg(self):
        return 'DROP DIRECTORY'

    # 匿名块执行成功提示信息
    @property
    def anonymous_block_success_msg(self):
        return 'ANONYMOUS BLOCK EXECUTE'

    # checkpoint执行成功提示信息
    @property
    def checkpoint_success_msg(self):
        return 'CHECKPOINT'

    # 删除索引成功提示信息
    @property
    def drop_index_success_msg(self):
        return 'DROP INDEX'

    # vacuum执行成功提示信息
    @property
    def vacuum_success_msg(self):
        return 'VACUUM'

    @property
    def update_success_msg(self):
        return 'UPDATE'

    @property
    def delete_success_msg(self):
        return 'DELETE'

    @property
    def cfe_inject_rcpu_overloadau_success_msg(self):
        return '[rCPU_Overload] - Injected fault successfully'

    @property
    def cfe_inject_rcpu_overloadau_cleaned_msg(self):
        return '[rCPU_Overload] - Cleaned fault successfully'

    @property
    def create_procedure_success_msg(self):
        return 'CREATE PROCEDURE'

    @property
    def drop_procedure_success_msg(self):
        return 'DROP PROCEDURE'

    #创建发布端成功
    @property
    def create_pub_succ_msg(self):
        return "CREATE PUBLICATION"

    #删除发布端成功
    @property
    def drop_pub_succ_msg(self):
        return "DROP PUBLICATION"

    #创建订阅端成功
    @property
    def create_sub_succ_msg(self):
        return 'CREATE SUBSCRIPTION'

    #删除订阅端成功
    @property
    def drop_sub_succ_msg(self):
        return 'DROP SUBSCRIPTION'

    #修改发布端成功
    @property
    def alter_pub_succ_msg(self):
        return 'ALTER PUBLICATION'

    #修改订阅端成功
    @property
    def alter_sub_succ_msg(self):
        return 'ALTER SUBSCRIPTION'

    #生成加密密码文件成功
    @property
    def create_keycipher_success(self):
        return "gs_guc generate -S ***"
    
    #创建视图
    @property
    def CREATE_VIEW_SUCCESS_MSG(self):
        return "CREATE VIEW"
        
    #删除视图
    @property
    def DROP_VIEW_SUCCESS_MSG(self):
        return "DROP VIEW"
        
    #创建物化视图
    @property
    def CREATE_MATERIALIZED_VIEW_MSG(self):
        return "CREATE MATERIALIZED VIEW"
    
    #删除物化视图
    @property
    def DROP_MATERIALIZED_VIEW_MSG(self):
        return "DROP MATERIALIZED VIEW"

    #创建物化视图
    @property
    def CREATE_ANONYMOUS_BLOCK_SUCCESS_MSG(self):
        return "ANONYMOUS BLOCK EXECUTE"

